home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / PInterfaces / PCCardTuples.p < prev    next >
Encoding:
Text File  |  1995-08-23  |  12.8 KB  |  421 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        PCCardTuples.p
  3.  
  4.      Contains:    List of PCMCIA tuple types and definitions of tuple contents.
  5.  
  6.      Version:    Technology: PCMCIA Software 2.0
  7.                 Package:    Universal Interfaces 2.1.1 in “MPW Latest” on ETO #19
  8.   
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.   
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT PCCardTuples;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __PCCARDTUPLES__}
  30. {$SETC __PCCARDTUPLES__ := 1}
  31.  
  32. {$I+}
  33. {$SETC PCCardTuplesIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$PUSH}
  43. {$ALIGN MAC68K}
  44. {$LibExport+}
  45.  
  46. CONST
  47.     MAX_TUPLE_SIZE                = 256;
  48.  
  49. {————————————————————————————————————————————————————————————————————————
  50.     Defines for Tuple codes
  51. ————————————————————————————————————————————————————————————————————————}
  52.     CISTPL_NULL                    = $00;
  53.     CISTPL_DEVICE                = $01;
  54.     CISTPL_LONGLINK_MFC            = $06;
  55.     CISTPL_CHECKSUM                = $10;
  56.     CISTPL_LONGLINK_A            = $11;
  57.     CISTPL_LONGLINK_C            = $12;
  58.     CISTPL_LINKTARGET            = $13;
  59.     CISTPL_NO_LINK                = $14;
  60.     CISTPL_VERS_1                = $15;
  61.     CISTPL_ALTSTR                = $16;
  62.     CISTPL_DEVICE_A                = $17;
  63.     CISTPL_JEDEC_C                = $18;
  64.     CISTPL_JEDEC_A                = $19;
  65.     CISTPL_CONFIG                = $1A;
  66.     CISTPL_CFTABLE_ENTRY        = $1B;
  67.     CISTPL_DEVICE_OC            = $1C;
  68.     CISTPL_DEVICE_OA            = $1D;
  69.     CISTPL_DEVICE_GEO            = $1E;
  70.     CISTPL_DEVICE_GEO_A            = $1F;
  71.     CISTPL_MANFID                = $20;
  72.     CISTPL_FUNCID                = $21;
  73.     CISTPL_FUNCE                = $22;
  74.     CISTPL_SWIL                    = $23;
  75.     CISTPL_VERS_2                = $40;
  76.     CISTPL_FORMAT                = $41;
  77.     CISTPL_GEOMETRY                = $42;
  78.     CISTPL_BYTEORDER            = $43;
  79.     CISTPL_DATE                    = $44;
  80.     CISTPL_BATTERY                = $45;
  81.     CISTPL_ORG                    = $46;
  82.     CISTPL_VENDOR                = $FE;
  83.     CISTPL_END                    = $FF;
  84.  
  85. {————————————————————————————————————————————————————————————————————————
  86.     Tuple Data Block Definitions
  87. ————————————————————————————————————————————————————————————————————————}
  88. {------------    Device Information Tuple (01H, 17H)    -----------                            }
  89.  
  90. TYPE
  91.     DeviceIDTuple = RECORD
  92.         TPLDEV_TYPE_WPS_SPEED:    SInt8; (* Byte *)                        { Device Type Code: 7-4, WPS: 3,  Device Speed: 2-0}
  93.         deviceData:                ARRAY [0..MAX_TUPLE_SIZE - 3-1] OF SInt8; (* Byte *)
  94.     END;
  95.  
  96.  
  97. CONST
  98.     TPLDEV_TYPE_MASK            = $F0;                            { device type mask for TPLDEV_TYPE_WPS_SPEED}
  99.     TPLDEV_TYPE_EXTENDED        = $E0;                            { device type value for extended type}
  100.     TPLDEV_WPS_MASK                = $08;                            { write-protect switch mask for TPLDEV_TYPE_WPS_SPEED}
  101.     TPLDEV_SPEED_MASK            = $07;                            { device speed mask for TPLDEV_TYPE_WPS_SPEED}
  102.     TPLDEV_DSPEED_NULL            = $00;                            { speed for null device type}
  103.     TPLDEV_DSPEED_250NS            = $01;                            { 250ns card access time}
  104.     TPLDEV_DSPEED_200NS            = $02;                            { 200ns card access time}
  105.     TPLDEV_DSPEED_150NS            = $03;                            { 150ns card access time}
  106.     TPLDEV_DSPEED_100NS            = $04;                            { 100ns card access time}
  107.     TPLDEV_EXTENDED_SPEED        = $07;                            { device speed value for extended speed}
  108.     TPLDEV_SPEED_EXPONENT        = $07;                            { extended byte exponent mask}
  109.     TPLDEV_SPEED_MANTISSA        = $78;                            { extended byte mantissa mask}
  110.     TPLDEV_SPEED_EXTENDED_MASK    = $80;                            { bit set if more extended speed data follows}
  111.  
  112. {    device ID types}
  113.     DTYPE_NULL                    = 0;
  114.     DTYPE_ROM                    = 1;
  115.     DTYPE_OTPROM                = 2;
  116.     DTYPE_EPROM                    = 3;
  117.     DTYPE_EEPROM                = 4;
  118.     DTYPE_FLASH                    = 5;
  119.     DTYPE_SRAM                    = 6;
  120.     DTYPE_DRAM                    = 7;
  121.     DTYPE_FUNCSPEC                = $0D;
  122.     DTYPE_EXTEND                = 14;
  123.  
  124. {---------------    Checksum Control Tuple (10H)    ---------------                            }
  125.  
  126. TYPE
  127.     ChecksumControlTuple = RECORD
  128.         TPLCKS_ADDR:            INTEGER;                                { offset to region to be checksummed, LSB first}
  129.         TPLCKS_LEN:                INTEGER;                                { length of region to be checksummed, LSB first}
  130.         TPLCKS_CS:                CHAR;                                    { checksum of the region}
  131.         reserved:                SInt8; (* Byte *)                        { padding}
  132.     END;
  133.  
  134. {----------------    Long Link Multi-Function Tuple (06H)    ------                    }
  135.     LongLinkMFCTuple = RECORD
  136.         TPLMFC_NUM:                SInt8; (* UInt8 *)                        { Number of sets of config registers for individual functions}
  137.         TPLMFC_TAS1:            SInt8; (* UInt8 *)                        { CIS target address space for first function (00 = Attr, 01 = Common)}
  138.         TPLMFC_ADDR1:            UInt32;                                    { Target address of first CIS, unsigned long, lsb first}
  139.         TPLMFC_TAS2:            SInt8; (* UInt8 *)                        { CIS target address space for second function (00 = Attr, 01 = Common)}
  140.         TPLMFC_ADDR2:            UInt32;                                    { Target address of second CIS, unsigned long, lsb first}
  141.         { the following fields are of undetermined length and should be calculated at runtime}
  142.         { }
  143.         { UInt8        TPLMFC_TASn;}
  144.         { UInt32        TPLMFC_ADDRn;}
  145.     END;
  146.  
  147. {----------------    Long Link Tuple (11H, 12H)    ----------------                            }
  148.     LongLinkTuple = RECORD
  149.         TPLL_ADDR:                UInt32;                                    { target address, LSB first}
  150.     END;
  151.  
  152. {-----------------    Link Target Tuple (13H)    ------------------                            }
  153.     LinkTargetTuple = RECORD
  154.         TPLL_TAG:                ARRAY [0..2] OF SInt8; (* Byte *)        { tag: should be 'C', 'I', 'S'}
  155.     END;
  156.  
  157. {----------------    Level 1 Version Tuple (15H)    ---------------                            }
  158.     Level1VersionTuple = RECORD
  159.         TPLLV1_MAJOR:            SInt8; (* Byte *)                        { major version number (0x04)}
  160.         TPLLV1_MINOR:            SInt8; (* Byte *)                        { minor version number (0x01 for release 2.0 and 2.01)}
  161.         TPLLV1_INFO:            ARRAY [0..0] OF SInt8; (* Byte *)        { product information string, zero-terminated}
  162.     END;
  163.  
  164. {-------------    JEDEC Identifier Tuple (18H, 19H)    ------------                            }
  165.     JEDECDeviceInfo = RECORD
  166.         manufacturerID:            SInt8; (* Byte *)
  167.         manufacturerInfo:        SInt8; (* Byte *)
  168.     END;
  169.  
  170.     JEDECIdentifierTuple = RECORD
  171.         device:                    ARRAY [0..0] OF JEDECDeviceInfo;
  172.     END;
  173.  
  174. {---------    Configuration Tuple (1AH)    ----------                            }
  175.     ConfigTuple = RECORD
  176.         TPCC_SZ:                SInt8; (* Byte *)                        { size of fields byte}
  177.         TPCC_LAST:                SInt8; (* Byte *)                        { index number of last config entry}
  178.         TPCC_RADR:                SInt8; (* Byte *)                        { config reg's base addr in reg. space}
  179.         reserved:                SInt8; (* Byte *)                        { padding}
  180.         { the following fields are of undetermined length and should be calculated at runtime}
  181.         {UInt32            TPCC_RMSK;}
  182.         {UInt32            TPCC_RSVD;}
  183.         {UInt32            TPCC_SBTPL;}
  184.     END;
  185.  
  186. {    TPCC_RADR field definitions}
  187.  
  188. CONST
  189.     TPCC_RASZ                    = $03;                            { bits 1-0}
  190.     TPCC_RMSZ                    = $3C;                            { bits 5-2}
  191.     TPCC_RFSZ                    = $C0;                            { bits 7-6}
  192.  
  193. {---------    Device Geometry Tuple (1EH, 1FH)    ----------}
  194.  
  195. TYPE
  196.     DeviceGeometry = RECORD
  197.         DGTPL_BUS:                SInt8; (* UInt8 *)                        { system bus width = 2^(n-1), n>0}
  198.         DGTPL_EBS:                SInt8; (* UInt8 *)                        { erase block size = 2^(n-1), n>0}
  199.         DGTPL_RBS:                SInt8; (* UInt8 *)                        { read block size = 2^(n-1), n>0}
  200.         DGTPL_WBS:                SInt8; (* UInt8 *)                        { write block size = 2^(n-1), n>0}
  201.         DGTPL_PART:                SInt8; (* UInt8 *)                        { partitioning size = 2^(n-1), n>0}
  202.         DGTPL_HWIL:                SInt8; (* UInt8 *)                        { hardware interleave = 2^(n-1), n>0}
  203.     END;
  204.  
  205.     DeviceGeometryTuple = RECORD
  206.         device:                    ARRAY [0..41] OF DeviceGeometry;
  207.     END;
  208.  
  209. {---------    Manufacturer Identification Tuple (20H)    ----------                            }
  210.     ManufIDTuple = RECORD
  211.         TPLMID_MANF:            INTEGER;                                { PCMCIA PC Card manufacturer code}
  212.         TPLMID_CARD:            INTEGER;                                { manufacturer information (part number and/or revision)}
  213.     END;
  214.  
  215. {-----------    Function Identification Tuple (21H)    ------------                            }
  216.     FunctionIDTuple = RECORD
  217.         TPLFID_FUNCTION:        SInt8; (* Byte *)                        { PC card function code}
  218.         TPLFID_SYSINIT:            SInt8; (* Byte *)                        { system initialization bit mask}
  219.     END;
  220.  
  221. {    function codes}
  222.  
  223. CONST
  224.     TPLFID_MultiFunction        = 0;
  225.     TPLFID_Memory                = 1;
  226.     TPLFID_SerialPort            = 2;
  227.     TPLFID_ParallelPort            = 3;
  228.     TPLFID_FixedDisk            = 4;
  229.     TPLFID_VideoAdaptor            = 5;
  230.     TPLFID_NetworkLANAdaptor    = 6;
  231.     TPLFID_AIMS                    = 7;
  232.  
  233. {------------    Software Interleave Tuple (23H)    ---------------                            }
  234.  
  235. TYPE
  236.     SoftwareInterleaveTuple = RECORD
  237.         TPLSWIL_INTRLV:            CHAR;                                    { software interleave}
  238.     END;
  239.  
  240. {-------    Level 2 Version and Information Tuple (40H)    --------                            }
  241.     Level2VersionTuple = RECORD
  242.         TPLLV2_VERS:            SInt8; (* Byte *)                        { structure version (0x00)}
  243.         TPLLV2_COMPLY:            SInt8; (* Byte *)                        { level of compliance with the standard (0x00)}
  244.         TPLLV2_DINDEX:            UInt16;                                    { byte address of first data byte in card, LSB first}
  245.         TPLLV2_RSV6:            SInt8; (* Byte *)                        { reserved, must be zero}
  246.         TPLLV2_RSV7:            SInt8; (* Byte *)                        { reserved, must be zero}
  247.         TPLLV2_VSPEC8:            SInt8; (* Byte *)                        { vendor specific byte}
  248.         TPLLV2_VSPEC9:            SInt8; (* Byte *)                        { vendor specific byte}
  249.         TPLLV2_NHDR:            CHAR;                                    { number of copies of CIS present on this device}
  250.         TPLLV2_OEM:                ARRAY [0..0] OF CHAR;                    { vendor of software that formatted card, zero-terminated}
  251.         TPLLV2_INFO:            ARRAY [0..0] OF CHAR;                    { informational message about the card, zero-terminated}
  252.         reserved:                SInt8; (* Byte *)                        { padding}
  253.     END;
  254.  
  255. {--------------------    Format Tuple (41H)    --------------------                            }
  256. { additional information for disk type:}
  257.     FormatDiskTuple = RECORD
  258.         TPLFMT_BKSZ:            UInt16;                                    {    block size, or zero if unblocked format}
  259.         TPLFMT_NBLOCKS:            UInt32;                                    {    number of data blocks in this partition}
  260.         TPLFMT_EDCLOC:            UInt32;                                    {    location of error detection code, or zero if interleaved}
  261.     END;
  262.  
  263. { additional information for disk type:}
  264.     FormatMemTuple = RECORD
  265.         TPLFMT_FLAGS:            SInt8; (* Byte *)                        {    various flags}
  266.         TPLFMT_RESERVED:        SInt8; (* Byte *)                        {    reserved, set to zero}
  267.         TPLFMT_ADDRESS:            UInt32;                                    {    physical location at which this memory partion must be mapped}
  268.         TPLFMT_EDCLOC:            UInt32;                                    {    location of error detection code, or zero if interleaved}
  269.     END;
  270.  
  271.     FormatTuple = RECORD
  272.         TPLFMT_TYPE:            CHAR;                                    { format type code}
  273.         TPLFMT_EDC:                CHAR;                                    { error detection method and length of error detection code}
  274.         TPLFMT_OFFSET:            LONGINT;                                { offset to first data byte in this partition}
  275.         TPLFMT_NBYTES:            LONGINT;                                { number of data bytes in this partition}
  276.         CASE INTEGER OF
  277.         0: (
  278.             TPLFMT_DISK:                FormatDiskTuple;
  279.            );
  280.         1: (
  281.             TPLFMT_MEM:                    FormatMemTuple;
  282.            );
  283.  
  284.     END;
  285.  
  286. {    format types}
  287.  
  288. CONST
  289.     TPLFMTTYPE_DISK                = 0;
  290.     TPLFMTTYPE_MEM                = 1;
  291.     TPLFMTTYPE_VS                = $80;
  292.  
  293. {    error detection types}
  294.     TPLFMTEDC_NONE                = 0;
  295.     TPLFMTEDC_CKSUM                = 1;
  296.     TPLFMTEDC_CRC                = 2;
  297.     TPLFMTEDC_PCC                = 3;
  298.     TPLFMTEDC_VS                = 8;
  299.  
  300. {    bits in TPLFMT_FLAGS}
  301.     TPLFMTFLAGS_ADDR            = 0;
  302.     TPLFMTFLAGS_AUTO            = 1;
  303.  
  304. {------------------    Geometry Tuple (42H)    --------------------                            }
  305.  
  306. TYPE
  307.     GeometryTuple = RECORD
  308.         TPLGEO_SPT:                CHAR;                                    { number of sectors per track}
  309.         TPLGEO_TPC:                CHAR;                                    { number of tracks per cylinder}
  310.         TPLGEO_NCYL:            INTEGER;                                { number of cylinders, total}
  311.     END;
  312.  
  313. {-----------------    Byte-Order Tuple (43H)    -------------------                            }
  314.     ByteOrderTuple = RECORD
  315.         TPLBYTE_ORDER:            CHAR;                                    { byte order code}
  316.         TPLBYTE_MAP:            CHAR;                                    { byte mapping code}
  317.     END;
  318.  
  319. {    byte order codes}
  320.  
  321. CONST
  322.     TYPBYTEORD_LOW                = 0;
  323.     TYPBYTEORD_HIGH                = 1;
  324.     TYPBYTEORD_VS                = $80;
  325.  
  326. {    byte mapping codes}
  327.     TYPBYTEMAP_LOW                = 0;
  328.     TYPBYTEMAP_HIGH                = 1;
  329.     TYPBYTEMAP_VS                = $80;
  330.  
  331. {----------    Card Initialization Date Tuple (44H)    ------------                            }
  332.  
  333. TYPE
  334.     CardInitDateTuple = RECORD
  335.         TPLDATE_TIME:            UInt16;                                    { hours, minutes, seconds}
  336.         TPLDATE_DAY:            UInt16;                                    { year, month, day}
  337.     END;
  338.  
  339. {----------    Battery-Replacement Date Tuple (45H)    ------------                            }
  340.     BatteryReplaceDateTuple = RECORD
  341.         TPLBATT_RDAY:            UInt16;                                    { last replacement date (year, month, day)}
  342.         TPLBATT_XDAY:            UInt16;                                    { battery expiration date (year, month, day)}
  343.     END;
  344.  
  345. {----------------------    General Tuple    -----------------------                            }
  346.     TupleBody = RECORD
  347.         CASE INTEGER OF
  348.         0: (
  349.             deviceID:                    DeviceIDTuple;
  350.            );
  351.         1: (
  352.             checksum:                    ChecksumControlTuple;
  353.            );
  354.         2: (
  355.             link:                        LongLinkTuple;
  356.            );
  357.         3: (
  358.             target:                        LinkTargetTuple;
  359.            );
  360.         4: (
  361.             level1:                        Level1VersionTuple;
  362.            );
  363.         5: (
  364.             jedecID:                    JEDECIdentifierTuple;
  365.            );
  366.         6: (
  367.             config:                        ConfigTuple;
  368.            );
  369.         7: (
  370.             devGeo:                        DeviceGeometryTuple;
  371.            );
  372.         8: (
  373.             manufID:                    ManufIDTuple;
  374.            );
  375.         9: (
  376.             funcID:                        FunctionIDTuple;
  377.            );
  378.         10: (
  379.             swil:                        SoftwareInterleaveTuple;
  380.            );
  381.         11: (
  382.             level2:                        Level2VersionTuple;
  383.            );
  384.         12: (
  385.             format:                        FormatTuple;
  386.            );
  387.         13: (
  388.             geometry:                    GeometryTuple;
  389.            );
  390.         14: (
  391.             order:                        ByteOrderTuple;
  392.            );
  393.         15: (
  394.             initDate:                    CardInitDateTuple;
  395.            );
  396.         16: (
  397.             battDate:                    BatteryReplaceDateTuple;
  398.            );
  399.         17: (
  400.             tupleData:                    ARRAY [0..MAX_TUPLE_SIZE - 2-1] OF SInt8; (* Byte *)
  401.            );
  402.     END;
  403.  
  404.     Tuple = RECORD
  405.         TPL_CODE:                SInt8; (* Byte *)
  406.         TPL_LINK:                SInt8; (* Byte *)
  407.         TPL_BODY:                TupleBody;
  408.     END;
  409.  
  410.  
  411. {$ALIGN RESET}
  412. {$POP}
  413.  
  414. {$SETC UsingIncludes := PCCardTuplesIncludes}
  415.  
  416. {$ENDC} {__PCCARDTUPLES__}
  417.  
  418. {$IFC NOT UsingIncludes}
  419.  END.
  420. {$ENDC}
  421.